﻿<%@ Page Title="" Language="C#" MasterPageFile="~/BaseInfoMaster.master" AutoEventWireup="true"
    CodeFile="SaleResult.aspx.cs" Inherits="AnalysisReport_SaleResult" CodeFileBaseClass="Frame.Pages.BasePage" %>

<%@ Register Assembly="DevExpress.Web.ASPxGridView.v10.2.Export, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView.Export" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.XtraReports.v10.2.Web, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.XtraReports.Web" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxCallbackPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v10.2.Linq, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Data.Linq" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxPanel" TagPrefix="dx" %>
<asp:Content ID="headContent" ContentPlaceHolderID="head" runat="Server">
    <link type="text/css" rel="stylesheet" href="../Content/Site.css" />
    <script type="text/javascript">
        function btnWin_Click(s, e) {
            if (grid.IsCustomizationWindowVisible())
                grid.HideCustomizationWindow();
            else
                grid.ShowCustomizationWindow();
            UpdateButtonText();
        }
        function grid_CustomizationWindowCloseUp(s, e) {
            UpdateButtonText();
        }
        function UpdateButtonText() {
            var text = grid.IsCustomizationWindowVisible() ? "隐藏" : "显示";
            text += "列定制窗口";
            btnWin.SetText(text);
        }
    </script>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <h1 class="DemoTitle">
        营销业绩分析
    </h1>
    <div id="DemoArea">
        <div class="Spacer" style="height: 14px;">
        </div>
        <table runat="server" id="QueryTable">
            <tr>
                <td colspan="6">
                    <table>
                        <tr>
                            <td>
                                <dx:ASPxLabel ID="ASPxLabel3" runat="server" Text="营销人员姓名：" Font-Size="10pt" CssFilePath="~/App_Themes/DevEx/{0}/styles.css"
                                    CssPostfix="DevEx">
                                </dx:ASPxLabel>
                            </td>
                            <td>
                                <dx:ASPxTextBox ID="txtSalesPerson" runat="server" Width="200px" CssFilePath="~/App_Themes/DevEx/{0}/styles.css"
                                    CssPostfix="DevEx" SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css">
                                </dx:ASPxTextBox>
                            </td>
                            <td>
                                <dx:ASPxButton runat="server" ID="btnWin" ClientInstanceName="btnWin" Text="显示列定制窗口"
                                    UseSubmitBehavior="False" AutoPostBack="False" CssFilePath="~/App_Themes/DevEx/{0}/styles.css"
                                    CssPostfix="DevEx" Font-Size="10pt" SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css">
                                    <ClientSideEvents Click="btnWin_Click" />
                                </dx:ASPxButton>
                            </td>
                            <td>
                                <dx:ASPxButton ID="btnExpand" runat="server" Text="全部展开" UseSubmitBehavior="False"
                                    AutoPostBack="False" Font-Size="10pt" CssFilePath="~/App_Themes/DevEx/{0}/styles.css"
                                    CssPostfix="DevEx" SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css">
                                    <ClientSideEvents Click="function() { grid.ExpandAllDetailRows() }" />
                                </dx:ASPxButton>
                            </td>
                            <td>
                                <dx:ASPxButton ID="btnCollapse" runat="server" Text="全部收起" UseSubmitBehavior="False"
                                    AutoPostBack="False" Font-Size="10pt" CssFilePath="~/App_Themes/DevEx/{0}/styles.css"
                                    CssPostfix="DevEx" SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css">
                                    <ClientSideEvents Click="function() { grid.CollapseAllDetailRows() }" />
                                </dx:ASPxButton>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td>
                    <dx:ASPxLabel ID="ASPxLabel1" runat="server" Text="开始时间：" Font-Size="10pt" CssFilePath="~/App_Themes/DevEx/{0}/styles.css"
                        CssPostfix="DevEx">
                    </dx:ASPxLabel>
                </td>
                <td>
                    <dx:ASPxDateEdit ID="datStart" runat="server" CssFilePath="~/App_Themes/DevEx/{0}/styles.css"
                        CssPostfix="DevEx" EnableAnimation="False" Font-Size="10pt" Spacing="0" SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css">
                        <CalendarProperties ClearButtonText="清除" TodayButtonText="今天">
                            <HeaderStyle Spacing="1px" />
                        </CalendarProperties>
                        <ButtonStyle Width="13px">
                        </ButtonStyle>
                    </dx:ASPxDateEdit>
                </td>
                <td>
                    <dx:ASPxLabel ID="ASPxLabel2" runat="server" Text="结束时间：" Font-Size="10pt" CssFilePath="~/App_Themes/DevEx/{0}/styles.css"
                        CssPostfix="DevEx">
                    </dx:ASPxLabel>
                </td>
                <td>
                    <dx:ASPxDateEdit ID="datEnd" runat="server" CssFilePath="~/App_Themes/DevEx/{0}/styles.css"
                        CssPostfix="DevEx" EnableAnimation="False" Font-Size="10pt" Spacing="0" SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css">
                        <CalendarProperties ClearButtonText="清除" TodayButtonText="今天">
                            <HeaderStyle Spacing="1px" />
                        </CalendarProperties>
                        <ButtonStyle Width="13px">
                        </ButtonStyle>
                    </dx:ASPxDateEdit>
                </td>
                <td>
                    <dx:ASPxButton ID="btnQuery" runat="server" CssFilePath="~/App_Themes/DevEx/{0}/styles.css"
                        CssPostfix="DevEx" Font-Size="10pt" SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css"
                        Text="查询" AutoPostBack="False" UseSubmitBehavior="False">
                        <ClientSideEvents Click="function(s,e){QueryPanel.PerformCallback(); }" />
                    </dx:ASPxButton>
                </td>
                <td>
                    <dx:ASPxButton ID="btnPrint" runat="server" CssFilePath="~/App_Themes/DevEx/{0}/styles.css"
                        CssPostfix="DevEx" Font-Size="10pt" SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css"
                        Text="导出Excel" UseSubmitBehavior="False" OnClick="btnPrint_Click">
                    </dx:ASPxButton>
                </td>
            </tr>
        </table>
        <dx:ASPxGridViewExporter ID="GridViewExporter" GridViewID="gridView" runat="server">
        </dx:ASPxGridViewExporter>
        <dx:ASPxCallbackPanel ID="QueryCBPanel" ClientInstanceName="QueryPanel" runat="server"
            CssFilePath="~/App_Themes/DevEx/{0}/styles.css" CssPostfix="DevEx" OnCallback="QueryCBPanel_Callback">
            <LoadingPanelImage Url="~/App_Themes/DevEx/Web/Loading.gif">
            </LoadingPanelImage>
            <LoadingPanelStyle ImageSpacing="5px">
            </LoadingPanelStyle>
            <PanelCollection>
                <dx:PanelContent runat="server" SupportsDisabledAttribute="True">
                    <dx:ASPxGridView ID="gridView" ClientInstanceName="grid" runat="server" Width="100%"
                        KeyFieldName="BookID" AutoGenerateColumns="False" CssFilePath="~/App_Themes/DevEx/{0}/styles.css"
                        CssPostfix="DevEx">
                        <Styles CssFilePath="~/App_Themes/DevEx/{0}/styles.css" CssPostfix="DevEx">
                            <Header ImageSpacing="5px" SortingImageSpacing="5px">
                            </Header>
                            <LoadingPanel ImageSpacing="5px">
                            </LoadingPanel>
                        </Styles>
                        <ImagesFilterControl>
                            <LoadingPanel Url="~/App_Themes/DevEx/GridView/Loading.gif">
                            </LoadingPanel>
                        </ImagesFilterControl>
                        <Images SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css">
                            <LoadingPanelOnStatusBar Url="~/App_Themes/DevEx/GridView/StatusBarLoading.gif">
                            </LoadingPanelOnStatusBar>
                            <LoadingPanel Url="~/App_Themes/DevEx/GridView/Loading.gif">
                            </LoadingPanel>
                        </Images>
                        <Columns>
                            <dx:GridViewDataTextColumn Caption="自动编码" FieldName="BookID" Name="t_BookID" ReadOnly="True"
                                VisibleIndex="0">
                                <EditFormSettings CaptionLocation="Near" />
                                <EditFormSettings CaptionLocation="Near"></EditFormSettings>
                                <CellStyle HorizontalAlign="Right">
                                </CellStyle>
                            </dx:GridViewDataTextColumn>
                            <dx:GridViewDataTextColumn Caption="营业时段" FieldName="PeriodName" Name="t_PeriodName"
                                VisibleIndex="1">
                                <CellStyle HorizontalAlign="Center">
                                </CellStyle>
                            </dx:GridViewDataTextColumn>
                            <dx:GridViewDataTextColumn Caption="联系人" FieldName="ContractName" Name="t_ConsumerName"
                                VisibleIndex="2">
                                <CellStyle HorizontalAlign="Center">
                                </CellStyle>
                            </dx:GridViewDataTextColumn>
                            <dx:GridViewDataDateColumn Caption="预定日期" FieldName="BookDate" Name="t_BookDate"
                                VisibleIndex="3">
                                <PropertiesDateEdit Spacing="0">
                                </PropertiesDateEdit>
                                <CellStyle HorizontalAlign="Center">
                                </CellStyle>
                            </dx:GridViewDataDateColumn>
                            <dx:GridViewDataDateColumn Caption="录入时间" FieldName="AddTime" Name="t_AddTime" VisibleIndex="4">
                                <PropertiesDateEdit Spacing="0">
                                </PropertiesDateEdit>
                                <CellStyle HorizontalAlign="Center">
                                </CellStyle>
                            </dx:GridViewDataDateColumn>
                            <dx:GridViewDataTextColumn Caption="订金单号" FieldName="BookNo" Name="t_BookNo" VisibleIndex="5">
                                <CellStyle HorizontalAlign="Left">
                                </CellStyle>
                            </dx:GridViewDataTextColumn>
                            <dx:GridViewDataTextColumn Caption="订金金额" FieldName="Money" Name="t_Money" VisibleIndex="6">
                                <CellStyle HorizontalAlign="Right">
                                </CellStyle>
                            </dx:GridViewDataTextColumn>
                            <dx:GridViewDataTextColumn Caption="电话号码" FieldName="ContractPhoneNum" Name="t_ContractPhoneNum"
                                VisibleIndex="7">
                                <CellStyle HorizontalAlign="Left">
                                </CellStyle>
                            </dx:GridViewDataTextColumn>
                            <dx:GridViewDataTextColumn Caption="预定桌数" FieldName="TableTotal" Name="t_TableTotal"
                                VisibleIndex="8">
                                <CellStyle HorizontalAlign="Right">
                                </CellStyle>
                            </dx:GridViewDataTextColumn>
                            <dx:GridViewDataTextColumn Caption="就餐人数" FieldName="PeopleNumber" Name="t_PeopleNumber"
                                VisibleIndex="9">
                                <CellStyle HorizontalAlign="Right">
                                </CellStyle>
                            </dx:GridViewDataTextColumn>
                            <dx:GridViewDataTextColumn Caption="操作员" FieldName="UserName" Name="t_UserName" VisibleIndex="10">
                                <CellStyle HorizontalAlign="Center">
                                </CellStyle>
                            </dx:GridViewDataTextColumn>
                            <dx:GridViewDataTextColumn Caption="消费金额" FieldName="ConsumerAmount" Name="t_ConsumerAmount"
                                VisibleIndex="11">
                                <CellStyle HorizontalAlign="Right">
                                </CellStyle>
                            </dx:GridViewDataTextColumn>
                        </Columns>
                        <Templates>
                            <DetailRow>
                                <dx:ASPxGridView ID="DgridView" runat="server" Width="100%" AutoGenerateColumns="False"
                                    CssFilePath="~/App_Themes/DevEx/{0}/styles.css" Font-Size="10pt" CssPostfix="DevEx"
                                    DataSourceID="SqlDataSourceMain" OnBeforePerformDataSelect="DgridView_BeforePerformDataSelect">
                                    <SettingsDetail IsDetailGrid="true" />
                                    <Styles CssFilePath="~/App_Themes/DevEx/{0}/styles.css" CssPostfix="DevEx">
                                        <Header ImageSpacing="5px" SortingImageSpacing="5px">
                                        </Header>
                                        <LoadingPanel ImageSpacing="5px">
                                        </LoadingPanel>
                                    </Styles>
                                    <ImagesFilterControl>
                                        <LoadingPanel Url="~/App_Themes/DevEx/GridView/Loading.gif">
                                        </LoadingPanel>
                                    </ImagesFilterControl>
                                    <Images SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css">
                                        <LoadingPanelOnStatusBar Url="~/App_Themes/DevEx/GridView/StatusBarLoading.gif">
                                        </LoadingPanelOnStatusBar>
                                        <LoadingPanel Url="~/App_Themes/DevEx/GridView/Loading.gif">
                                        </LoadingPanel>
                                    </Images>
                                    <Columns>
                                        <dx:GridViewDataTextColumn FieldName="TableName" Caption="桌号" VisibleIndex="1" CellStyle-HorizontalAlign="Center">
                                        </dx:GridViewDataTextColumn>
                                        <dx:GridViewDataTextColumn FieldName="Remark" Caption="备注" VisibleIndex="2" CellStyle-HorizontalAlign="Left">
                                        </dx:GridViewDataTextColumn>
                                    </Columns>
                                </dx:ASPxGridView>
                                <asp:SqlDataSource ID="SqlDataSourceMain" ConnectionString="<%$ ConnectionStrings:CMSConnectionString %>"
                                    SelectCommand="SELECT a.*,b.TableName FROM BLI_BookDetail a,BI_Tables b WHERE b.TableID=a.Table_ID AND a.BookNo = @BookNo" runat="server"
                                    ProviderName="<%$ ConnectionStrings:CMSConnectionString.ProviderName %>">
                                    <SelectParameters>
                                        <asp:SessionParameter Name="BookNo" SessionField="BookNo" />
                                    </SelectParameters>
                                </asp:SqlDataSource>
                            </DetailRow>
                        </Templates>
                        <Settings ShowFooter="True" />
                        <SettingsDetail ShowDetailRow="true" ExportMode="Expanded" />
                        <StylesEditors ButtonEditCellSpacing="0">
                            <ProgressBar Height="21px">
                            </ProgressBar>
                        </StylesEditors>
                        <SettingsCustomizationWindow Enabled="True" />
                        <ClientSideEvents CustomizationWindowCloseUp="grid_CustomizationWindowCloseUp" />
                        <TotalSummary>
                            <dx:ASPxSummaryItem FieldName="BookID" SummaryType="Count" DisplayFormat="次数：{0}" />
                            <dx:ASPxSummaryItem FieldName="ConsumerAmount" SummaryType="Sum" DisplayFormat="总消费金额：{0:c}" />
                            <dx:ASPxSummaryItem FieldName="Money" SummaryType="Sum" DisplayFormat="总订金金额：{0:c}" />
                            <dx:ASPxSummaryItem FieldName="PeopleNumber" SummaryType="Sum" DisplayFormat="总人数：{0}" />
                            <dx:ASPxSummaryItem FieldName="TableTotal" SummaryType="Sum" DisplayFormat="总桌数：{0}" />
                        </TotalSummary>
                    </dx:ASPxGridView>
                </dx:PanelContent>
            </PanelCollection>
        </dx:ASPxCallbackPanel>
    </div>
</asp:Content>
